﻿package Utils 
{
	
	import be.wellconsidered.services.WebService;
	import be.wellconsidered.services.Operation;
	import be.wellconsidered.services.events.OperationEvent;
	import flash.display.Sprite;
	import GameEvents;
	import org.osflash.thunderbolt.Logger;
	
	public class WebServiceCommunication extends Sprite
	{
		
		public function WebServiceCommunication() 
		{
			
		}
		
		public function MapPosition(x:int, y:int, z:int, radius:int):void
		{
			var ws:WebService = new WebService("http://www.senor.co.yu/GameWebService.asmx?wsdl");
			var op:Operation = new Operation(ws);

			op.addEventListener(OperationEvent.COMPLETE, onResult);
			op.addEventListener(OperationEvent.FAILED, onFault);
			op.GetRangeData(x, y, z, radius);
		}
		
		private function onResult(e:OperationEvent):void 
		{ 
			this.dispatchEvent(new GameEvents(e.data.toString(),"MapViewData"));
		}
		
		private function onFault(e:OperationEvent):void 
		{ 
			
		}

	}
	
}